"""
@Time : 2021/9/16 14:33 
@Author : 常雷
@File : t_30filter和lambda.py
@Software: PyCharm
"""
'''
行代码通过filter和Lambda函数输出以下列表索引为奇数对应的元素
list_a = [12, 213, 22, 2, 2, 2, 22, 2, 2, 2, 32]
'''
list_a = [12, 213, 22, 2, 2, 2, 22, 2, 2, 2, 32]
print([y[1] for y in (filter(lambda x: x[0] % 2 == 1, ((i, list_a[i]) for i in range(len(list_a)))))])
print([list_a[y] for y in (filter(lambda x: x % 2 == 1, (i for i in range(len(list_a)))))])